package model;

import java.util.Date;

public class StartStop {

	private String name;
	private Date start;
	private Date stop;
	private Subware subware = null;
	private Subtreatment subtreatment;

	public StartStop(String name, Subware subware, Subtreatment subtreatment) {
		this.name = name;
		this.subware = subware;
		subware.addStartStop(this);
		this.subtreatment = subtreatment;
		subtreatment.addStartStop(this);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getStop() {
		return stop;
	}

	public void setStop(String date) {
		if (getStop() == null) {
			stop = DateUtil.createDate(date);
		}

	}

	public void setStart(String date) {
		if (getStart() == null) {
			start = DateUtil.createDate(date);
		}
	}

	public Date getStart() {
		return start;
	}

	public void setSubware(Subware subware) {
		if (this.subware != subware)
			this.subware = subware;
	}

	public Subtreatment getSubtreatment() {
		return subtreatment;
	}

	public void setSubtreatment(Subtreatment subtreatment) {
		if (this.subtreatment != subtreatment)
			this.subtreatment = subtreatment;
	}

	public Subware getSubware() {
		return subware;
	}

	@Override
	public String toString() {
		return name + "Start: " + start + ", " + "Stop: " + stop;
	}

}
